package com.he.observedmodel.observed.concreteobserved;

import com.he.observedmodel.observed.Observed;
import com.he.observedmodel.subject.Subject;

public class Concreteobserved2 implements Observed {

    private String name;
    private String state;
    private Subject<String> subject;

    public Concreteobserved2(String name, String state, Subject subject) {
        this.name = name;
        this.state = state;
        this.subject = subject;
    }

    @Override
    public void update() {
        this.state = subject.getState();
    }

    @Override
    public String toString() {
        return "Concreteobserved2{" +
                "name='" + name + '\'' +
                ", state='" + state + '\'' +
                ", subject=" + subject +
                '}';
    }
}
